# -*- encoding: utf-8 -*-
"""
@File    : practice.py
@Time    : 2020/10/20 10:44
@Author  : lluyao
@Email   : lluyao61@163.com
@Software: PyCharm
"""
'''
import math

a = int(input("第一条边："))
b = int(input("第二条边："))
c = int(input("第三条边："))
p = (a + b + c) / 2

if a > 0 and b > 0 and c > 0:
    if a + b > c and a + c > b and b + c > a:
        s = math.sqrt(p * (p - a) * (p - b) * (p - c))
        print(s)
    else:
        print("您输入的三边不能构成三角形")
else:
    print("边长不能为负")

if a <= 0 and b <= 0 and c <= 0:
    print("边长不能为负")
elif a + b <= c and a + c <= b and b + c <= a:
    print("您输入的三边不能构成三角形")
else:
    s = math.sqrt(p * (p - a) * (p - b) * (p - c))
    print(s)

'''
# for i in range(3):
#     username = input("请输入用户名：")
#     if username != 'root':
#         print(f"用户名不存在！登录失败！还有{2-i}次机会")
#     else:
#         password = input("请输入密码：")
#         if password != '123456':
#             print(f"密码错误!登录失败！还有{2-i}次机会")
#         else:
#             print(f"登录成功！您使用了{i+1}机会")
#             break
# else :
#     print("登录次数已用尽！")


# str1 = input('输入字符串：')
# for i in str1:
#     print('1',end='') if i.isupper() else print ('0',end='')
'''
import random
aim_num = random.randint(1, 10)
print("系统已随机生成一个1-10以内的数字!",aim_num )
for i in range(3):
    user_input = input(f"您还有{3-i}次猜数字的机会，请输入数字：")
    if user_input.isdigit():
        test_num = int(user_input)
        if test_num>aim_num:
            print("您输入的数字大于目标数字！")
        elif test_num<aim_num:
            print("您输入的数字小于目标数字！")
        else:
            print(f"您猜对了！使用了{i+1}次机会")
            break
    else:
        print('您的输入有误，请重新输入！')
else:
    print('很遗憾，三次机会已用尽。')
'''

# for i in range(9):
#     for j in range(i+1):
#         print(f'{j+1}×{i+1}={(j+1)*(i+1)}',end='  ')
#     print()

# for i in range(100, 1000):
#     hundreds = int(i / 100)
#     tens = int((i - hundreds * 100) / 10)
#     ones = i - hundreds * 100 - tens * 10
#     if hundreds ** 3 + tens ** 3 + ones ** 3 == i:
#         print(i, end=' ')


i=0
while i<3:
    username = input("请输入用户名：")
    if username != 'root':
        print(f"用户名不存在！登录失败！还有{2-i}次机会")
        i+=1
    else:
        password = input("请输入密码：")
        if password != '123456':
            print(f"密码错误!登录失败！还有{2-i}次机会")
            i+=1
        else:
            print(f"登录成功！您使用了{i+1}机会")
            break
else :
    print("登录次数已用尽！")
